/**
 * \file Wrapper.h
 *
 * Asteriskos Compiler 1
 * Written 2010, by Anthony Berlin and Alexander Carlqvist
 *
 * This file is part of ICC.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef WRAPPER_H
#define WRAPPER_H

#include <iostream>
#include <string>
#include <vector>
#include <list>

#ifdef __WIN32__
    #include <windows.h>
    #include <sys/timeb.h>

    inline int get_ticks()
    {
        timeb tb;
        ftime(&tb);
        int nCount = tb.millitm + (tb.time & 0xfffff) * 1000;
        return nCount;
    }

    inline int get_milli_span(int nTimeStart)
    {
        int nSpan = get_ticks() - nTimeStart;
        if (nSpan < 0)
            nSpan += 0x100000 * 1000;
        return nSpan;
    }
#endif
#ifdef __linux__
    #include <sys/times.h>
    inline unsigned int get_ticks()
    {
        tms* buf = new tms;
        int ticks = 0;

        times(buf);
        ticks = buf->tms_stime;

        delete buf;

        return ticks;
    }
#endif
#ifdef __APPLE__
    #include <ctime>
    inline unsigned int get_ticks()
    {
        return clock();
    }
#endif

#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
#include <boost/unordered_map.hpp>

using std::cout;
using std::cerr;
using std::string;
using std::vector;
using std::list;

using boost::to_upper;
using boost::to_lower;
using boost::trim;
using boost::split;

#define foreach BOOST_FOREACH

using boost::unordered_map;

#endif // WRAPPER_H
